<?php
/* This file is part of Mirasol CMS
   (C) 2011 by Chris Alban Hansen.
   Released under the terms of the GNU General Public License.
   See COPYING in the top level directory of the Mirasol CMS installation. */

include "{$_SERVER['DOCUMENT_ROOT']}/includes/config.php";

/* Fields */
$sample_fields1 = <<<END
<template>
<field type="text" name="headline" label="Headline" />
<field type="largetext" name="postformat" label="Plain text" />
<field type="html" name="content" label="Content" />
</template>
END;

$sample_fields2 = <<<END
<template>
<field type="image" name="imglogo" label="Choose a logo" />
<field type="text" name="headline" label="Headline" />
<field type="text" name="version" label="Version number" />
<field type="text" name="copyright" label="Copyright" />
<field type="text" name="license" label="License" />
</template>
END;

/* Pages */
$sample_page1 = <<<END
<page>
<title>Front page</title>
<fields>
<headline>Welcome to a $app_name powered website</headline>
<postformat>This is post-formatted plain text.&lt;br/&gt;It's formatted with new lines.&lt;br/&gt;&lt;br/&gt;And it works!</postformat>
<content>&lt;p&gt;Hello, world!&lt;/p&gt;</content>
</fields>
</page>
END;

$app_copyright_enc = htmlentities ($app_copyright, ENT_COMPAT, "UTF-8", true);
$sample_page2 = <<<END
<page>
<title>About</title>
<fields>
<imglogo>$app_websitepath/file.php?fn=mirasol_icon.png</imglogo>
<headline>About $app_name</headline>
<version>$app_version</version>
<copyright>$app_copyright_enc</copyright>
<license>$app_license</license>
</fields>
</page>
END;

/* Layouts */
$sample_layout1 = <<<END
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:php="http://php.net/xsl" version="1.0">

  <xsl:output method="xml" version="1.0" indent="yes" encoding="utf-8"
    omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.1//EN"
    doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />
  
  <xsl:include href="sublayouts/Poweredby.xsl" />

  <xsl:template match="/page">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>
          <xsl:value-of select="title" disable-output-escaping="yes" />
          |
          <xsl:value-of select="\$sitename" />
        </title>
        
        <link rel="stylesheet" href="{\$defaultstyle}" type="text/css" />
      </head>
      
      <body>
        <h1><xsl:value-of select="fields/headline" disable-output-escaping="yes" /></h1>
        <xsl:value-of select="fields/content" disable-output-escaping="yes" />
        <p><xsl:value-of select="fields/postformat" disable-output-escaping="yes" /></p>
        <xsl:call-template name="poweredby" />
      </body>
      
    </html>
  </xsl:template>
</xsl:stylesheet>
END;

$sample_layout2 = <<<END
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:php="http://php.net/xsl" version="1.0">

  <xsl:output method="xml" version="1.0" indent="yes" encoding="utf-8"
    omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.1//EN"
    doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />
  
  <xsl:include href="sublayouts/Poweredby.xsl" />

  <xsl:template match="/page">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>
          <xsl:value-of select="title" disable-output-escaping="yes" />
          |
          <xsl:value-of select="\$sitename" />
        </title>
        
        <style type="text/css">
          <xsl:value-of select="\$defaultstyle" disable-output-escaping="yes" />
        </style>
      </head>
      
      <body>
        <h1>
          <img class="logo">
            <xsl:attribute name="src">
              <xsl:value-of select="fields/imglogo" disable-output-escaping="yes" />
            </xsl:attribute>
          </img>
          <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
          <xsl:value-of select="fields/headline" disable-output-escaping="yes" />
        </h1>
        <p>
          <strong>Version: </strong><xsl:value-of select="fields/version" disable-output-escaping="yes" />
        </p>
        <p>
          <strong><xsl:value-of select="fields/copyright" disable-output-escaping="yes" /></strong><br />
          <xsl:value-of select="fields/license" disable-output-escaping="yes" />
        </p>
        <xsl:call-template name="poweredby" />
      </body>
      
    </html>
  </xsl:template>
</xsl:stylesheet>
END;

$sample_sublayout = <<<END
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:php="http://php.net/xsl" version="1.0">

  <xsl:template name="poweredby">
    <p>
      <a href="http://albantech.com/MirasolCMS"><img src="{\$img_powered}" alt="Powered by Mirasol CMS" /></a>
    </p>
  </xsl:template>
</xsl:stylesheet>
END;

$newlayout = <<<END
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:php="http://php.net/xsl" version="1.0">

  <xsl:output method="xml" version="1.0" indent="yes" encoding="utf-8"
    omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.1//EN"
    doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />

  <xsl:template match="/page">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>
          <xsl:value-of select="title" disable-output-escaping="yes" />
          |
          <xsl:value-of select="\$sitename" />
        </title>
      </head>
      
      <body>
        <xsl:comment />
      </body>
      
    </html>
  </xsl:template>
</xsl:stylesheet>
END;

$newsublayout = <<<END
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:php="http://php.net/xsl" version="1.0">

  <xsl:template name="name_of_sublayout">
    <xsl:comment />
  </xsl:template>
</xsl:stylesheet>
END;

$sample_style = <<<END
body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}
h1 { color: #8800ff; }
img { border: none; }

.logo {
  float: left;
  height: 32px;
  width: 32px;
}
END;
?>
